package com.hotel.order.mq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.hotel.order.config.RabbitConfig.ORDER_EVENT_EXCHANGE;

@Component
public class OrderCreatedPublisher {

    @Autowired
    private AmqpTemplate amqpTemplate;

    public void publishOrderCreated(Long orderId) {
        amqpTemplate.convertAndSend(ORDER_EVENT_EXCHANGE, "order.created", orderId);
    }
}
